package com.kenai.jbosh;

import java.io.IOException;
import java.io.StringReader;
import java.lang.ref.SoftReference;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

final class BodyParserXmlPull
  implements BodyParser
{
  private static final Logger LOG = Logger.getLogger(BodyParserXmlPull.class.getName());
  private static final ThreadLocal<SoftReference<XmlPullParser>> XPP_PARSER = new ThreadLocal()
  {
    protected SoftReference<XmlPullParser> initialValue()
    {
      return new SoftReference(null);
    }
  };

  // ERROR //
  private static XmlPullParser getXmlPullParser()
  {
    // Byte code:
    //   0: getstatic 34	com/kenai/jbosh/BodyParserXmlPull:XPP_PARSER	Ljava/lang/ThreadLocal;
    //   3: invokevirtual 45	java/lang/ThreadLocal:get	()Ljava/lang/Object;
    //   6: checkcast 47	java/lang/ref/SoftReference
    //   9: invokevirtual 48	java/lang/ref/SoftReference:get	()Ljava/lang/Object;
    //   12: checkcast 50	org/xmlpull/v1/XmlPullParser
    //   15: astore_0
    //   16: aload_0
    //   17: ifnonnull +54 -> 71
    //   20: invokestatic 56	org/xmlpull/v1/XmlPullParserFactory:newInstance	()Lorg/xmlpull/v1/XmlPullParserFactory;
    //   23: astore_2
    //   24: aload_2
    //   25: iconst_1
    //   26: invokevirtual 60	org/xmlpull/v1/XmlPullParserFactory:setNamespaceAware	(Z)V
    //   29: aload_2
    //   30: iconst_0
    //   31: invokevirtual 63	org/xmlpull/v1/XmlPullParserFactory:setValidating	(Z)V
    //   34: aload_2
    //   35: invokevirtual 66	org/xmlpull/v1/XmlPullParserFactory:newPullParser	()Lorg/xmlpull/v1/XmlPullParser;
    //   38: astore_3
    //   39: new 47	java/lang/ref/SoftReference
    //   42: dup
    //   43: aload_3
    //   44: invokespecial 69	java/lang/ref/SoftReference:<init>	(Ljava/lang/Object;)V
    //   47: astore 4
    //   49: getstatic 34	com/kenai/jbosh/BodyParserXmlPull:XPP_PARSER	Ljava/lang/ThreadLocal;
    //   52: aload 4
    //   54: invokevirtual 72	java/lang/ThreadLocal:set	(Ljava/lang/Object;)V
    //   57: aload_3
    //   58: areturn
    //   59: astore_1
    //   60: new 74	java/lang/IllegalStateException
    //   63: dup
    //   64: ldc 76
    //   66: aload_1
    //   67: invokespecial 79	java/lang/IllegalStateException:<init>	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   70: athrow
    //   71: aload_0
    //   72: areturn
    //   73: astore_1
    //   74: goto -14 -> 60
    //
    // Exception table:
    //   from	to	target	type
    //   20	49	59	java/lang/Exception
    //   49	57	73	java/lang/Exception
  }

  public BodyParserResults parse(String paramString)
    throws BOSHException
  {
    BodyParserResults localBodyParserResults = new BodyParserResults();
    while (true)
    {
      try
      {
        localXmlPullParser = getXmlPullParser();
        StringReader localStringReader = new StringReader(paramString);
        localXmlPullParser.setInput(localStringReader);
        i = localXmlPullParser.getEventType();
        continue;
        if (i == 2)
        {
          if (LOG.isLoggable(Level.FINEST))
            LOG.finest("Start tag: " + localXmlPullParser.getName());
          String str1 = localXmlPullParser.getPrefix();
          if (str1 == null)
            str1 = "";
          String str2 = localXmlPullParser.getNamespace();
          String str3 = localXmlPullParser.getName();
          QName localQName = new QName(str2, str3, str1);
          if (LOG.isLoggable(Level.FINEST))
          {
            LOG.finest("Start element: ");
            LOG.finest("    prefix: " + str1);
            LOG.finest("    URI: " + str2);
            LOG.finest("    local: " + str3);
          }
          BodyQName localBodyQName1 = AbstractBody.getBodyQName();
          if (localBodyQName1.equalsQName(localQName))
            break label551;
          throw new IllegalStateException("Root element was not '" + localBodyQName1.getLocalPart() + "' in the '" + localBodyQName1.getNamespaceURI() + "' namespace.  (Was '" + str3 + "' in '" + str2 + "')");
        }
      }
      catch (RuntimeException localRuntimeException)
      {
        XmlPullParser localXmlPullParser;
        localObject = localRuntimeException;
        BOSHException localBOSHException = new BOSHException("Could not parse body:\n" + paramString, (Throwable)localObject);
        throw localBOSHException;
        i = localXmlPullParser.next();
        continue;
        if (j < localXmlPullParser.getAttributeCount())
        {
          String str4 = localXmlPullParser.getAttributeNamespace(j);
          if (str4.length() == 0)
            str4 = localXmlPullParser.getNamespace(null);
          String str5 = localXmlPullParser.getAttributePrefix(j);
          if (str5 == null)
            str5 = "";
          String str6 = localXmlPullParser.getAttributeName(j);
          String str7 = localXmlPullParser.getAttributeValue(j);
          BodyQName localBodyQName2 = BodyQName.createWithPrefix(str4, str6, str5);
          if (LOG.isLoggable(Level.FINEST))
            LOG.finest("        Attribute: {" + str4 + "}" + str6 + " = '" + str7 + "'");
          localBodyParserResults.addBodyAttributeValue(localBodyQName2, str7);
          j++;
          continue;
        }
      }
      catch (XmlPullParserException localXmlPullParserException)
      {
        localObject = localXmlPullParserException;
        continue;
      }
      catch (IOException localIOException)
      {
        int i;
        Object localObject = localIOException;
        continue;
        if (i != 1)
          continue;
      }
      return localBodyParserResults;
      label551: int j = 0;
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.kenai.jbosh.BodyParserXmlPull
 * JD-Core Version:    0.6.2
 */